/**
 * @file implements DataStorage
 * @author CORSAIR <vladimir.corsair@gmail.com>
 * @version 1.1
 */

var DataStorage = function() {
    this.writer = null;
    if(typeof Storage === "undefined") {
        this.writer = new DataCookieWriter();
    } else {
        this.writer = new DataStorageWriter();
    }
    
    this.set = function(k, v) {
        return this.writer.set(k, v);
    };
    
    this.get = function (k) {
        return this.writer.get(k);
    };
    
    this.remove = function (k) {
        if(typeof k === "object") {
            for(var x in k) {
                this.writer.remove(k[x]);
            }
        } else {
            this.writer.remove(k);
        }
    };
};

String.prototype.toNumber = function () {
    return parseFloat(this);
};